﻿package mortal.game.view.chat.chatViewData
{
    import __AS3__.vec.*;
    import com.gengine.utils.pools.*;
    import flash.text.engine.*;
    import mortal.game.view.chat.chatPanel.*;

    public class ChatItemData extends Object implements IDispose
    {
        private var _type:String;
        private var _cellVector:Vector.<ChatCellData>;

        public function ChatItemData()
        {
            return;
        }// end function

        public function init(param1:String = null, param2:Vector.<ChatCellData> = null) : void
        {
            if (!param1)
            {
                param1 = ChatType.World;
            }
            this._type = param1;
            this._cellVector = param2;
            return;
        }// end function

        public function get type() : String
        {
            return this._type;
        }// end function

        public function set type(param1:String) : void
        {
            this._type = param1;
            return;
        }// end function

        public function get cellVector() : Vector.<ChatCellData>
        {
            return this._cellVector;
        }// end function

        public function set cellVector(param1:Vector.<ChatCellData>) : void
        {
            this._cellVector = param1;
            return;
        }// end function

        public function addCellData(param1:ChatCellData) : void
        {
            this._cellVector.push(param1);
            return;
        }// end function

        public function getAllElements() : Vector.<ContentElement>
        {
            var _loc_2:String = null;
            var _loc_5:int = 0;
            var _loc_1:* = new Vector.<ContentElement>;
            var _loc_3:* = ObjectPool.getObject(ChatCellData);
            _loc_3.init(CellDataType.IMAGE);
            _loc_3.className = ChatStyle.getTitleImageName(this._type);
            _loc_3.elementFormat = ChatStyle.getImageFormat(5);
            var _loc_4:* = ObjectPool.getObject(ChatCell);
            _loc_4.init(_loc_3);
            _loc_1.push(_loc_4.cellContentElement);
            if (this._cellVector)
            {
                _loc_5 = 0;
                while (_loc_5 < this._cellVector.length)
                {
                    
                    _loc_4 = ObjectPool.getObject(ChatCell);
                    _loc_4.init(this._cellVector[_loc_5]);
                    _loc_1.push(_loc_4.cellContentElement);
                    _loc_5++;
                }
            }
            return _loc_1;
        }// end function

        public function getContentElement() : Vector.<ContentElement>
        {
            var _loc_2:int = 0;
            var _loc_3:ChatCell = null;
            var _loc_1:* = new Vector.<ContentElement>;
            if (this._cellVector)
            {
                _loc_2 = 0;
                while (_loc_2 < this._cellVector.length)
                {
                    
                    _loc_3 = ObjectPool.getObject(ChatCell);
                    _loc_3.init(this._cellVector[_loc_2]);
                    _loc_1.push(_loc_3.cellContentElement);
                    _loc_2++;
                }
            }
            return _loc_1;
        }// end function

        public function dispose(param1:Boolean = true) : void
        {
            this._type = null;
            this._cellVector = null;
            ObjectPool.disposeObject(this);
            return;
        }// end function

    }
}
